# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: BlackEagle <ike.devolder@gmail.com>
# Contributor: Dany Martineau <dany.luc.martineau@gmail.com>

pkgname=clementine
pkgver=1.4.0rc2
pkgrel=2
pkgdesc='A modern music player and library organizer'
url=https://www.clementine-player.org/
license=(GPL)
arch=(loong64 x86_64)
depends=(chromaprint gst-plugins-base-libs libcdio libgpod liblastfm-qt5 libmtp libmygpo-qt5
         taglib protobuf qt5-x11extras projectm alsa-lib libpulse crypto++ hicolor-icon-theme)
makedepends=(boost cmake qt5-tools sparsehash)
optdepends=(
  'gst-plugins-base: "Base" plugin libraries'
  'gst-plugins-good: "Good" plugin libraries'
  'gst-plugins-bad: "Bad" plugin libraries'
  'gst-plugins-ugly: "Ugly" plugin libraries'
  'gst-libav: Libav plugin'
  'gvfs: Various devices support'
)
source=("https://github.com/clementine-player/Clementine/releases/download/${pkgver//+/-}/$pkgname-${pkgver//+/-}.tar.xz")
sha256sums=('c8152ae241e2e681b4d6647d858a05f66e600d7ee32eccb090fa915093b8724a')

prepare() {
  sed -e 's|CRYPTOPP cryptopp|CRYPTOPP libcryptopp|' -i $pkgname-${pkgver//+/-}/CMakeLists.txt # Fix crypto++ detection
}

build() {
  cmake -B build -S $pkgname-${pkgver//+/-} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_SYSTEM_PROJECTM=ON \
    -DUSE_SYSTEM_TAGLIB=ON
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
